<!DOCTYPE html>
<html lang="en">
  <head>
      <meta charset="UTF-8">
      <title>let变量</title>
    <script type="text/javascript">

      // let name = "lmy";
      /*
        console.log("name=", name); 使用，可以输出对象的完整信息
        console.log("name=" + name); 使用+ ，字符串拼接。如果name是一个对象，会输出Object
       */
      // console.log("name=", name);

      /*
        1.let声明的变量有严格的局部作用域
        2.let只能声明一次,var可以声明多次
        3.let不存在变量提升，var存在变量提升
       */
      {
        var name = "lmy";
        console.log("name=", name);
        let job = "java工程师";
        console.log("job=", job);
      }
      console.log("name=", name);
      //console.log("job=", job);   //not defined

      var num1 = 100;
      var num1 = 200;
      console.log(num1);

      let num2 = 600;
      //let num2 = 600; //Uncaught SyntaxError
      console.log(num2);

      console.log("x=", x); //undefined
      var x = "tom";

      var y;
      console.log("y=", y); //undefined

      console.log("z=", z); //Uncaught ReferenceError
      let z = "mary";
    </script>
  </head>
  <body>

  </body>
</html>